<!-- 预览卡牌组件 -->
<template>
  <div class="previewdisplay-container">
    <div class="item">
      <div class="text" :class="{ TextAppear: isShow }">
        {{ props.title }}
      </div>
      <div class="box" :class="{ BoxAppear: isShow }">
        <div class="icon">
          <Icon :type="icon" />
        </div>
        <div class="content" v-html="props.html"></div>
      </div>
    </div>
  </div>
</template>

<script setup>
import Icon from "@/components/Icon/index.vue";
const props = defineProps({
  title: {
    type: String,
    required: true,
  },
  html: {
    type: String,
    required: true,
  },
  isShow: {
    type: Boolean,
    default: false,
  },
  icon: {
    type: String,
    required: true,
  },
});
</script>

<style lang="less">
@import "@/styles/var.less";
.previewdisplay-container {
  width: 100%;
  height: 100%;

  .item {
    width: 180px;
    height: 230px;

    position: relative;
    .text {
      perspective: 500px;
      border: 3px solid transparent;
      border-image: linear-gradient(to right, @frameColor1, @frameColor2) 2 2;
      clip-path: inset(0 round 6px);
      transition: all 0.5s linear;
      backface-visibility: hidden;
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 20px;
      color: @gray;
    }
    .box {
      perspective: 500px;
      border: 3px solid transparent;
      border-image: linear-gradient(to right, @frameColor1, @frameColor2) 2 2;
      clip-path: inset(0 round 6px);
      width: 100%;
      height: 100%;
      transform-origin: center top;
      transform: rotateY(-180deg);
      backface-visibility: hidden;
      transition: all 0.5s linear;
      position: absolute;
      left: 0;
      top: 0;
      padding: 5px 0;
      z-index: 99;
      .icon {
        font-size: 30px;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        line-height: 50px;
        margin: 0 auto;
        background: linear-gradient(0deg, @frameColor1, @frameColor2);
      }
      p {
        margin: 5px 0;
      }
      text-align: center;
      .title {
        font-size: 25px;
        font-weight: bold;
      }
      .people {
        font-size: 12px;
        color: @gray;
      }
      .price {
        color: @danger;
      }
    }
    .TextAppear {
      transform: rotateY(-180deg);
    }
    .BoxAppear {
      transform: rotateY(0);
    }
  }
}
</style>